package com.moter.demo01.io.in_outputstream.filterstream.pushbackstream;

import java.io.*;

public class PushBackInputStreamDemo {
    public static void main(String[] args) throws IOException {
        File file = new File("src\\main\\java\\com\\moter\\demo01\\io\\in_outputstream\\filterstream\\pushbackstream\\pushback.txt");
        FileInputStream fileInputStream = new FileInputStream(file);
        PushbackInputStream pushbackInputStream = new PushbackInputStream(fileInputStream,10);
        int b ;
        int num=0;
        while((b=pushbackInputStream.read())!=-1){
            if(b=='a') {
                pushbackInputStream.unread('b');//指定不读的字符
            }else
                System.out.print((char) b);
        }
        System.out.println((byte)8&0xff);
    }
}
